home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13929 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: news.luc.edu!news
  2. From: rolson@luc.edu (Rick Olson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Why should I use classes....or should I?
  5. Date: 28 Mar 1996 01:03:58 GMT
  6. Organization: Loyola University Chicago
  7. Message-ID: <4jcohu$7c8@artemis.it.luc.edu>
  8. NNTP-Posting-Host: 147.126.89.57
  9. Mime-Version: 1.0
  10. Content-Type: Text/Plain; charset=ISO-8859-1
  11. X-Newsreader: WinVN 0.99.5
  12.  
  13. I am an experienced FORTRAN programmer and have a reasonable 
  14. knowledge of C.  Most of my programming is related to my research
  15. which is generally related to constructing and comparing heuristic
  16. alogorithms for difficult problems.  I am about to start a new
  17. project and am trying to decide whether C++ is appropriate.  I'd
  18. appreciate any feedback.
  19.  
  20. Suppose I want to compare 10 algorithms for solving a problem (eg 
  21. bin packing).  With C I would code the routines for each algorithm
  22. and then write something to read the data and run it through each
  23. algorithm printing the results.  From where I sit this is pretty
  24. straight forward.  All the algorithms require the same input
  25. data (perhaps item sizes) and reports the same results (number of
  26. bins, solution time...).  This seems to be a function driven
  27. application rather than a data driven app.
  28.  
  29. There are a few features of C++ that are more appealing than C.
  30. Not needing to pass integer addresses to functions, then dereference
  31. them is one.  Right now I don't see any compelling argument for 
  32. using classes unless it is to learn how they work.  In fact, it seems
  33. to me that if I use classes I will actually pay a performance penalty
  34. because of the overhead associated with binding functions that can't
  35. be done at compilation time because of the possibility of polymorphism.
  36.  
  37. Am I missing something?  Is there a reason why I should be trying to
  38. think in terms of objects rather than thinking of C++ as "a better C".
  39.  
  40. I would appreciate any personal opinions/experience and pointers to 
  41. good books that may help me understand the *WHY* of OOP for these 
  42. types programs rather than just the *HOW* of classes.
  43.  
  44. Thanks in advance--
  45. Rick Olson
  46.  
  47.